//
//  GameModel.h
//  CandyDizzle
//
//  Created by Cloner Team on 8/2/14.
//
//

#ifndef GAMEMODEL_H
#define GAMEMODEL_H

#include "cocos2d.h"
#include "../../util/include/util.h"
#include "../../listeners/include/listeners.h"
#include "../entity/Color.h"
#include "../sound/SoundModel.h"
#include "../sound/SoundCommand.h"
USING_NS_CC;
class GameModel: public Ref {
    UG_PROPERTY_FULL(cocos2d::Size, displayResolutionSize, DisplayResolutionSize);
    UG_PROPERTY_FULL(cocos2d::Point, vectorMove, VectorMove);
    UG_PROPERTY_GETTER(SoundModel*, soundModel, SoundModel);
    UG_PROPERTY_FULL(int, gameState, GameState);
    UG_PROPERTY_GETTER(__Array*, listeners, Listeners);
    UG_PROPERTY_FULL(deque<Color*>, colorQueue, ColorQueue);
    UG_PROPERTY_FULL(int, currentScore, CurrentScore);
    UG_PROPERTY_FULL(int, highScore, HighScore);
    UG_PROPERTY_FULL(int, numberGames, NumberGames);
    UG_PROPERTY_FULL(__Array*, removedColors, RemovedColors);
    UG_PROPERTY_FULL(int, correctAfterIncrease, CorrectAfterIncrease);
public:
    bool canChoose;
    bool hasIncreasedSpeed;
    int fullScreenAdsHandling;
    static GameModel* getInstance();
    void update(float dt);
    void initialize();
    void createNewColor();
    void handleCorrectChoice();
    void finishGame();
    
    void addListener(UGListener* listener);
    void fireDisplayMenu(); //GUILayer
    void fireDisplayGame(); //GUILayer
    void fireDisplayResult(); //GUILayer
    void fireNewColor(); //GameScene
    void fireIncreaseSpeed(); //GameScene
    void fireCorrectChoice(); //GameScene
    void fireReturnToNormal();
    
    void callbackDelColor(Ref* data);
    void saveInformation();
    void loadInformation();
private:
    GameModel();
    ~GameModel();
};
#endif /* defined(__CandyDizzle__GameModel__) */
